package com.zeyi.chat.utils;

import redis.clients.jedis.Jedis;

/**
 * @author zeyi
 */
public class RedisUtil {

    private static final String HOST = "127.0.0.1";

    public static void save(String key, String value, int seconds) {
        Jedis jedis = new Jedis(HOST);
        jedis.setex(key, seconds, value);
        jedis.close();
    }

    public static String get(String key) {
        Jedis jedis = new Jedis(HOST);
        String value = jedis.get(key);
        jedis.close();
        return value;
    }

    public static void del(String key) {
        Jedis jedis = new Jedis(HOST);
        jedis.del(key);
        jedis.close();
    }
}
